<template>
	<view class="setUp" :class="APPTheme">
		<view class="status_bar"></view>
		<uni-nav-bar fixed @clickLeft="navigateBack" left-icon="back" title="设置" :color="APPTheme=='theme-light'?'#000000':'#ffffff'" :background-color="APPTheme=='theme-light'?'#ffffff':'#000000'"></uni-nav-bar>
		<view class="center">
			<uni-list :class='APPTheme'>
			    <uni-list-item v-for="(item,index) in ulist" :key="index" :note="item.note||''" :title="item.title" :show-arrow="true" :showExtraIcon="true" :extraIcon="item.extraIcon" @click="navgetTo(item)"></uni-list-item>
			</uni-list>
			<wButton class="outLogin" text="退出登录" bgColor="linear-gradient(to right, rgba(10,177,87,0.7), rgba(50,135,200,0.6))" @click.native="SignOut()"></wButton>
			<!-- <view class="outLogin" @click="SignOut"></view> -->
		</view>
	</view>
</template>

<script>
let that
import {mapGetters,mapActions} from 'vuex'
import wButton from '@/components/watch-login/watch-button.vue' //button
export default {
	components:{
		wButton
	},
	data() {
		return {
			ulist:[{
				title:'修改密码',
				extraIcon:{
					color: '#4cd964',
					size: '24',
					type: 'contact'
				}
			},
			{
				title:'设置聊天量子通信手势',
				note:'此功能为开启聊天量子通信时所需要的密码',
				extraIcon:{
					color: '#ff9f00',
					size: '22',
					type: 'locked-filled'
				}
			},
			{
				title:'关于助手',
				extraIcon:{
					color: '#0088fe',
					size: '22',
					type: 'shop'
				}
			}]
		}
	},
	computed: {
		...mapGetters(['APPTheme','userInfo','api']),
	},
	onLoad() {
		that=this
	},
	onShow() {
		//设置主题颜色
		that.GLOBAL.setThemeColor(that.APPTheme)
	},
	methods: {
		...mapActions(['remove_userInfo']),
		navigateBack(){
			uni.navigateBack({delta: 1});
		},
		navgetTo(item){
			if(item.title=='修改密码'){
				uni.navigateTo({url: '../../template/changePassword/changePassword'});
			}else if(item.title=='设置聊天量子通信手势'){
				uni.navigateTo({url: '../../IM/components/mpvue-gesture-lock/mpvue-gesture-lock?page=index_setUp'});
			}
		},
		SignOut(){
			try {
				that.$lizhao.lzwebSocket.lz_websoket(false)
				that.remove_userInfo('')
				clearInterval(getApp().globalData.time)
			} catch (e) {
			    // error
				console.log('清除数据失败',e);
			}
			uni.reLaunch({
				url: '../../template/login/login',
				success: res => {},
				fail: () => {},
				complete: () => {}
			});
		}
		
	}
};
</script>

<style lang="scss" scoped>
@import './setUp.scss';
</style>

